const got = require('got');

got('http://localhost:8082/test')
  .then(response => {
    console.log(response.body);
  })
  .catch(error => {
    console.log(error.response.body);
  });